export type InterceptorType<T> = T extends 'request' 
    ? Request 
    : Response

export type InterceptorHandlerType<T> = T extends 'request' 
    ? RequestInterceptor | RequestInterceptor[]
    : ResponseInterceptor | ResponseInterceptor[]

export interface InterceptorHandler<T> {
    onFulfilled?: (value: T) => T | Promise<T>
    onRejected?: (error: any) => any
}

export type RequestInterceptor = InterceptorHandler<Request>
export type ResponseInterceptor = InterceptorHandler<Response>

export interface InterceptorOptions {
    request?: RequestInterceptor | RequestInterceptor[]
    response?: ResponseInterceptor | ResponseInterceptor[]
}